package servlet;
import java.io.*;
import java.sql.*;
import java.util.*;
import servlet.Connections;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class getDevelopersProject extends HttpServlet {
	private static final long serialVersionUID = 1L;
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		Connections conn=new Connections();
		Statement stmt=null;
		ResultSet rs=null;
		String developerName,query,xmlSelectProject;
		PrintWriter out;
		try
		{
			out=response.getWriter();
			developerName=request.getParameter("dName");
			query="select p.Project_name from developer d,developerproject p where d.Developer_Id=p.Developer_Id and d.Developer_Name='"+developerName+"'";
			
			//out.println(developerName);
			//out.println(query);
			
			stmt=conn.getConnection().createStatement();
			rs=stmt.executeQuery(query);
			xmlSelectProject="<select name='Project'><option value=-1>--select--</option>";
			
			while(rs.next())
			{
				xmlSelectProject+="<option>"+rs.getString("Project_Name")+"</option>";
			}
			xmlSelectProject+="</select>";
			out.println(xmlSelectProject);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	

	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{		}

}
